Skip to content

Add EWTS message to Bmi_Module_Formulation's get_response on BMI error thrown (NGWPC-7474) - #13

Merged
idtodd merged 9 commits into
developmentfrom
ewts-messages-on-bmi-update-failure
Aug 28, 2025
Merged

Add EWTS message to Bmi_Module_Formulation's get_response on BMI error thrown (NGWPC-7474)#13
idtodd merged 9 commits into
developmentfrom
ewts-messages-on-bmi-update-failure

Conversation

@idtodd

@idtodd idtodd commented Aug 26, 2025

Copy link
Copy Markdown

Adds an EWTS log when a formulation model throws an error during the Update[Until] call. The message includes information on which formulation and catchment the error occurred on and information injected through set_model_inputs_prior_to_update. Logging this information will help debugging errors in data in the future.

Additions

  • Try/Catch block for capturing errors around Update() for logging. After the data is captured, the error will be thrown again.
  • A function that will convert the inputs in set_model_inputs_prior_to_update as a string that will be added to the error message.
  • Helper functions for converting BMI data types and appending it to a stringstream.

Testing

Results of running ngen with one line added that throws an error before running Update to test error handling:
2025-08-26T20:17:33.698 NGEN INFO Log File: /home/ian.todd/run-logs/Ian.Todd@nextgenwaterprediction.com/ngen_20250826T201733.log
2025-08-26T20:17:33.698 NGEN INFO Log level set to INFO
2025-08-26T20:17:33.698 NGEN INFO NGen Framework 0.3.0
2025-08-26T20:17:33.856 NGEN INFO Building Nexus collection
2025-08-26T20:17:33.857 NGEN INFO Building Catchment collection
2025-08-26T20:17:33.871 NGEN INFO Initializing formulations
2025-08-26T20:17:33.889 NGEN INFO Bmi_Adapter: Model name: test_bmi_cpp
2025-08-26T20:17:33.908 NGEN INFO Bmi_Adapter: Model name: test_bmi_cpp
2025-08-26T20:17:33.926 NGEN INFO Bmi_Adapter: Model name: test_bmi_cpp
2025-08-26T20:17:33.926 NGEN INFO Not Using Routing
2025-08-26T20:17:33.926 NGEN INFO Building Feature Index
2025-08-26T20:17:33.927 NGEN INFO Catchment topology is dendritic.
2025-08-26T20:17:33.927 NGEN INFO Running Models
2025-08-26T20:17:33.933 NGEN SEVERE Call to Update of model test_bmi_cpp failed for catchment "cat-52" at t_index = 0, next_step_index = 0.
2025-08-26T20:17:33.933 NGEN SEVERE Input variables were as follows:
2025-08-26T20:17:33.933 NGEN SEVERE precip_rate = 0
2025-08-26T20:17:33.933 NGEN SEVERE TMP_2maboveground = 285.9

Checklist

  • PR has an informative and human-readable title
  • Changes are limited to a single goal (no scope creep)
  • Code can be automatically merged (no conflicts)
  • Code follows project standards (link if applicable)
  • Passes all existing automated tests
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future todos are captured in comments
  • Project documentation has been updated (including the "Unreleased" section of the CHANGELOG)
  • Reviewers requested with the Reviewers tool ➡️

Testing checklist (automated report can be put here)

Target Environment support

  • Linux

@idtodd idtodd self-assigned this Aug 26, 2025
@idtodd
idtodd requested a review from cmaynard-ngwpc August 26, 2025 20:25
@cmaynard-ngwpc
cmaynard-ngwpc force-pushed the ewts-messages-on-bmi-update-failure branch from 6d65fd8 to d916358 Compare August 27, 2025 03:06
Comment thread src/realizations/catchment/Bmi_Module_Formulation.cpp Outdated
Comment thread src/realizations/catchment/Bmi_Module_Formulation.cpp Outdated
@idtodd
idtodd merged commit 5b660d5 into development Aug 28, 2025
3 checks passed
@idtodd
idtodd deleted the ewts-messages-on-bmi-update-failure branch August 28, 2025 16:26
zhengtaocui pushed a commit that referenced this pull request May 18, 2026
…r thrown (NGWPC-7474) (#13)

Adds an EWTS log when a formulation model throws an error during the Update[Until] call. The message includes information on which formulation and catchment the error occurred on and information injected through set_model_inputs_prior_to_update. Logging this information will help debugging errors in data in the future.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants